package spring.cloud.canary.demo.configure;


import jk.framework.canary.core.repository.VersionInfoRepository;
import jk.framework.canary.core.rule.ConditionEqualsRule;
import jk.framework.canary.core.rule.RouteRule;
import jk.framework.canary.core.rule.VersionEqualsRule;
import jk.framework.spring.cloud.canary.loadbalancer.configure.CurrentApiVersionProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import spring.cloud.canary.demo.rule.DemoHeaderCanaryRule;


/**
 * @author cuichao
 */
@Configuration
@EnableConfigurationProperties(value = {CurrentApiVersionProperties.class})
public class CanaryVersionConfigure {


    @Bean
    public VersionInfoRepository versionInfoRepository(){
        return new LocalVersionInfoRepository();
    }

    @Bean
    public RouteRule demoHeaderCanaryRule() { return new DemoHeaderCanaryRule();}

    //@Bean
    public RouteRule conditionEqualsRule(){
        return new ConditionEqualsRule("123");
    }

    //@Bean
    public RouteRule versionEqualsRouteRule(){
        return new VersionEqualsRule();
    }
}
